﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using SacNetUG.Constraints;

namespace SacNetUG
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : HttpApplication
    {
        public static Boolean RoutesLoaded;
        public static HashSet<string> CmsRoutes = new HashSet<string>();

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "LogOnLiveID",
                "webauth/sample/webauth-handler.aspx",
                new { controller = "Account", action = "LiveId" }
                );

            routes.MapRoute(
                "SpecialEvent",
                "SpecialEvent",
                new {controller = "Event", action = "Detail", id = "1"}
                );

            routes.MapRoute(
                "Page",
                "{controller}/Page/{pageNumber}",
                new {action = "Index"}
                );

            routes.MapRoute(
                "Content",
                "Content/{action}/{controllerToEdit}/{actionToEdit}",
                new { controller = "Content", action = "Create", controllerToEdit = "", actionToEdit = "" }
                );

        routes.MapRoute( 
                "Default",                                            // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" },  // Parameter defaults
                new { cmsRouteConstraints = new CmsContentConstraint()}
                );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}